package com.demo;

public class MaoPao {
    public static void main(String[] args) {
        int[] a = {6, 8, 7, 8, 6, 7, 8, 43, 4, 0};
        sort(a);
        print(a);

    }

    static void sort(int[] a) {
        for (int j = a.length - 1; j > 0; j--) {
            for (int i = 0; i < j; i++) {
                if (a[i] > a[i + 1]) {
                    swap(a, i, i + 1);
                }
            }
        }
    }

    static void swap(int[] a, int i, int j) {
        int temp = a[i];
        a[i] = a[j];
        a[j] = temp;
    }


    static void print(int[] arr) {
        for (int i : arr) {
            System.out.print(i + ",");
        }
    }
}
